<template>
    <div>
      <form @submit.prevent="update">
        用户名<input type="text" v-model="username">
        <input type="submit" value="修改">
      </form>
    </div>
</template>

<script>
  import axios from 'axios'
    export default {
        name: "Update",
      data:function () {
        return{
          username:''
        }
      },
      methods:{
          update(){
            axios({
              url:'http://127.0.0.1:8000/update/',
              method:'post',
              data:{
                username: this.username,
                id_: this.$route.query.id
                // id_: this.$route.query.id
              }
            }).then(res=>{
              console.log(res)
              window.location.href='#/index'
            })
          }
      }
    }
</script>

<style scoped>

</style>
